# 完全日期
from datetime import *


def complete_date(start, end):
    td = timedelta(days=1)
    cnt = 0
    while start != end:
        year = start.year // 1000 + start.year // 100 % 10 + start.year // 10 % 10 + start.year % 10
        month = start.month // 10 % 10 + start.month % 10
        day = start.day // 10 % 10 + start.day % 10
        if ((year + month + day) ** 0.5) % 1 == 0:
            cnt += 1
        start += td
    return cnt



if __name__ == '__main__':
    start = date(2001, 1, 1)
    end = date(2021, 12, 31)
    print(complete_date(start, end))
